package com.ksana.orm.mapper;

import com.ksana.orm.annotation.Delete;
import com.ksana.orm.annotation.Insert;
import com.ksana.orm.annotation.Select;
import com.ksana.orm.annotation.Update;
import com.ksana.orm.domain.Do.TempNameDO;
import com.ksana.orm.domain.Do.TypeDO;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Fall
 */
public interface TempMapper {
    @Select(statement = "select name from t_temp where id = #{id}")
    TempNameDO selectNameById(Integer id);

    @Select(statement = "select id from t_temp")
    List<Long> selectUserNum();

    @Select(statement = "select name from t_temp where i = #{i}")
    List<TempNameDO> selectNameByI(Integer i);

    @Insert(statement = "insert into t_temp (name, i) values ('#{name}', #{i})")
    Integer insertNameAndI(String name, Integer i);

    @Update(statement = "update t_temp set name = '#{name}' where id = #{id}")
    Integer updateNameById(String name, Integer id);

    @Delete(statement = "delete from t_temp where id = #{id}")
    Integer deleteById(Integer id);

    @Select(statement = "select id, name from t_type where parent_id = #{parentId}")
    ArrayList<TypeDO> getTypeByParentId(Integer parentId);
}
